using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class PageTemplateMap : EntityTypeConfiguration<PageTemplate>
    {
        public PageTemplateMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Locale)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.Template)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.PageName)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.KV)
                .HasMaxLength(2000);

            this.Property(t => t.Hook)
                .HasMaxLength(2000);

            this.Property(t => t.ModifyBy)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PageTemplate");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Locale).HasColumnName("Locale");
            this.Property(t => t.Template).HasColumnName("Template");
            this.Property(t => t.PageName).HasColumnName("PageName");
            this.Property(t => t.KV).HasColumnName("KV");
            this.Property(t => t.Hook).HasColumnName("Hook");
            this.Property(t => t.ModifyBy).HasColumnName("ModifyBy");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
        }
    }
}
